﻿#region Usings

using System.Data.Entity.ModelConfiguration;
using Rail.Net.Core.Model;

#endregion

namespace Rail.Net.Data.Configuration
{
    public class ReservableTrainLabelMap : EntityTypeConfiguration<ReservableTrainLabel>
    {
        public ReservableTrainLabelMap()
        {
            ToTable("ReservableTrainLabels");
            HasKey(reservableTrainLabel => reservableTrainLabel.Id);

            Property(reservableTrainLabel => reservableTrainLabel.TrainLabel).IsRequired().HasMaxLength(10);
            Property(reservableTrainLabel => reservableTrainLabel.Domestic).IsRequired();
            Property(reservableTrainLabel => reservableTrainLabel.International).IsRequired();
            Property(reservableTrainLabel => reservableTrainLabel.ValidFrom).IsOptional();
            Property(reservableTrainLabel => reservableTrainLabel.ValidTo).IsOptional();
        }
    }
}